load('MAT/Step_2_firm_data_alpha4.mat');
count_F = full(sum(firmsecD_sorted,1));
VA_f_sector = firmsecD_sorted.*repmat(VA_f_Stata,[1 J]);
VA_sector = full(sum(VA_f_sector,1));
VA_sector = VA_sector./sum(VA_sector);

NT_sectors={'E','F','50','51','52','H','60','61','62','63','64',...
                        'J','70','71t74','L','M','N','O','P'}';
WIOD_sectors = {'AtB' , 'C' , '15t16' ,'17t18' , '19' , '20' , '21t22' ,...
    '23' , '24' , '25' ,'26', '27t28', '29' , '30t33' , '34t35' ,...
    '36t37', 'E' , 'F' , '50', '51', '52', 'H', '60', '61', '62', '63',...
    '64', '70', '71t74', 'M', 'N', 'O'}';                     
T = ones(J,1);
for i =1:J
    for j=1:size(NT_sectors,1)
        if isequal(WIOD_sectors{i},NT_sectors{j})
            T(i,1)=0;
        end
    end
end


Table = table(WIOD_sectors,count_F',VA_sector',T);
Table.Properties.VariableNames = {'Sector' 'Nb firms' 'Share VA' 'Traded/non-traded'};
filename=['Tables/TableA1.xlsx'];
writetable(Table,filename,'Sheet','TableA1');
   